<%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>
<!--#include file="includes/cb_adovbs_sys.inc"-->
<!--#include file="includes/header_sys.asp"-->
<!--#include file="includes/generally_sys.asp"-->
<!--#include file="includes/translate.asp"-->
<%
On Error Resume Next
'Codepage einstellen
Session.CodePage = 65001'Unicode, 8-bit encoding
Response.CharSet = "utf-8"
'Sprache -----------------------------------------------------------------
Dim i_lng
i_lng = Request("lng")
If IsEmpty(i_lng) or IsNull(i_lng) or i_lng = 0 Then
If IsEmpty(Session("ses_i_language") or Session("ses_i_language") = 0 or IsNull(Session("ses_i_language"))) Then
i_lng = 1
Else
i_lng = Session("ses_i_language")
End If
end if
if i_lng = 0 Then i_lng = 1 end if
Session("ses_i_language")=i_lng'0=keine auswahl 1=german 2=english
'--------------------------------------------------------------------------

'sprache
Dim lng_id
lng_id = i_lng
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open strComplete_sys

'If Session("ses_iu") = 0 and Session("ses_ig") = 0 Then

'SYS
Session("ses_title")="Growmetry"
Session("ses_admin_log")="Admin"
Session("ses_first_log")="EX-"
Session("ses_i_first_log")=0'1=first login 0=kein first login
Session("ses_i_log")=0'0=first login (key)
Session("ses_Username_log")=0'eingabe login
Session("ses_Password_log")=0'eingabe login

Session("ses_str_User_id")="n/a"'die eingeloggte userid
Session("ses_str_User_info_all")="n/a"'die eingeloggte userid + head org + sub org + trainer
Session("ses_str_pw")="n/a"'das eigegebene pw
Session("ses_str_User_name")="n/a"'der eingeloggte username

Session("ses_path_sys")="http://localhost/www_zwick01/sys/main_menue.asp"
Session("ses_i")=0'zählt mit wie oft mit einer session (browserfenster) angemeldet wurde

Session("ses_iu")=0'user id
Session("ses_ig")=0'user group

Session("str_logfree")="A1"'ob userid und pw ok sind - A1 >> nein - A0 >> ok

Session("ses_str_master_id")="n/a"'die eindeutige vom system erstellt pw zb. lhQsnMNkBJIJ
Session("ses_str_log_id")="n/a"'die eindeutige vom system erstellt userid zb. E0-YNRKBFKUEE und ohne <E0->

    'email
    'i_type
    '2 - Head Org	
    '3 - Org		
    '4 - Trainer		
    '5 - Athlete
    Session("ses_i_ebene")=0'von welcher ebene aus wird dsa email aufgerufen
    Session("ses_i_email_template")=0'vorlage für das emailtemplate
    Session("ses_user_email")=0'die mailadresse des eingelogten users
    Session("ses_mail_from")="office@growmetry.com" 'Absender 
    Session("ses_mail_to")="n/a"'emailadresse an wem das mail gesendet wird
    Session("ses_mail_to_02")="n/a"'falls an eine zweite emailadresse gesendet wird
    Session("ses_mail_subject")="n/a"
    Session("ses_mail_body")="n/a"
    Session("ses_mail_user_name")="n/a"'der name des user der das mail bekommen wird

    'zeichenlaenge (min. laenge)
    Session("ses_sub_org_len")=3
    Session("ses_coach_len")=3
    Session("ses_userid_len")=4
    Session("ses_pw_len")=8
    Session("ses_master_id")=12'zeichenlänge die eindeutige vom system erstellt pw zb. lhQsnMNkBJIJ
    Session("ses_log_id")=10'zeichenlänge die eindeutige vom system erstellt userid zb. E0-YNRKBFKUEE und ohne <E0->

        'schleifendurchlauf
        Session("ses_i_pw_loop")=9999'wie oft bei der pw vergabe vom system eine schleife durchlaufen werden soll

        'tmp session für die id des forms das geöffnet werden soll
        'beim ersten login
        Session("ses_frm_first_register")=0
        'headorg
        Session("ses_id_tmp_01")=0
        Session("ses_frm_go_back_01")=0
        'division
        Session("ses_id_tmp_02")=0
        Session("ses_frm_go_back_02")=0
        'emailinfo
        Session("ses_i_email_template")=0


        '0 >> normalbetrieb - 1 > Applikation im entwicklungsstatus - nur für testbetrieb - es werden wichtige var ausgegeben
        Session("ses_dev")=0

        'das eindeutige pw für das erstmalige loggin
        Session("ses_str_master_id")=0

        'entscheidet ob mit diverse admin all frm gearbeitet werden darf oder nur seine eigenen stammdaten zu sehen sind
        'Session("ses_i_stammdaten_look")=0

        'id
        Session("ses_i_usergroup")=0
        Session("ses_i_admin")=1'zwick
        Session("ses_i_head_org")=0'id des head org
        Session("ses_i_org")=0'id des org
        Session("ses_i_trainer")=0'id des trainers
        Session("ses_i_athlete")=0'id des athleten

        Session("ses_str_head_org")=0'string des head org
        Session("ses_str_org")=0'string des org
        Session("ses_str_trainer")=0'string des trainers
        Session("ses_str_name_admin_head_org")=0'string des admin der head org
        Session("ses_str_name_admin_division")=0'string des admin der division
        Session("ses_str_name_admin_trainer")=0'string des admin der division


        'id der letzten Auswahl... zb. wenn man ein Form verläßt und wieder zurück kommt wird das drop wiede so ausgewählt
        'zb. trainer_admin_all.asp	
        Session("ses_i_last_select_01")=0
        Session("ses_i_last_select_02")=0


        'isx = 0 >> keine neue stammdateneingabe übers login
        'isx = 2 >> neue head org stammdateneingabe übers login
        'isx = 3 >> neue org stammdateneingabe übers login
        'isx = 4 >> neue trainer stammdateneingabe übers login
        'isx = 5 >> neue athlete stammdateneingabe übers login	
        Session("ses_i_isx")=0

        'i_type 1=Admin / 2=Head Org / 3=Org / 4=Trainer / 5=Athlete
        'wenn es ein login ist wo der benutzer selber auswählen kann ob er sub-org oder ein trainer ist
        'dann ist >>Session("ses_i_type")=0
        Session("ses_i_type")=0


        'wenn es für den angelegt user eine dummy org (Non Commercial) darüber gibt >>> = 1	
        Session("ses_i_dummy_head_org")=0
        Session("ses_i_dummy_sub_org")=0


        'killed alle sessions
        'Session.Abandon

        Dim str_title
        str_title = Session("ses_title")

        Dim str_emaillink
        str_emaillink = Request("reg")

        'falls über die admin overview geöffnet wird
        Dim a1
        a1 = Request("a1")
        Dim a2
        a2 = Request("a2")

        'Response.Write("A2: " & a2)

        %>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
            <!-- ----------------------------------------------------------- -->
            <!--       Beratung, Projektierung, Webdesign und Umsetzung      -->
            <!--                     www.on-designs.com                      -->
            <!-- Christian Freidl, Gärtnerweg 6, 8073 Neuseiersberg, Austria -->
            <!-- ----------------------------------------------------------- -->
            <!-- ----------------------------------------------------------- -->
            <!--        Beratung, Projektierung, ASP-Programmierung          -->
            <!--                     www.bribase.com                         -->
            <!--                    Peter Brislinger,                        -->
            <!--        Paul-Anton-Keller-Gasse 23, 8073 Feldkirchen         -->
            <!-- ----------------------------------------------------------- -->
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                <title><%= str_title %> - Bitte einloggen</title>
                <LINK REL="SHORTCUT ICON" HREF="http://www.growmetry.com/favicon.ico">
                    <meta name="author" content="Programming by Peter Brislinger, http://www.bribase.com | Web & Interfacedesign by Christian Freidl, http://www.on-designs.com" />
                    <meta name="robots" content="noindex, nofollow" />
                    <meta name="audience" content="all" />
                    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
                    <style type="text/css">
                        <!--
                        A:link, A:visited, A:active {text-decoration: none; color:#333333}
                        A:hover {text-decoration: underline}
                        body {
                            margin-left: 0px;
                            margin-top: 0px;
                            margin-right: 0px;
                            margin-bottom: 0px;
                            SCROLLBAR-FACE-COLOR: #ffffff; 
                            SCROLLBAR-HIGHLIGHT-COLOR: #ffffff;
                            SCROLLBAR-SHADOW-COLOR: #cccccc;
                            SCROLLBAR-3DLIGHT-COLOR: #cccccc;
                            SCROLLBAR-ARROW-COLOR: #666666;
                            SCROLLBAR-TRACK-COLOR: #ffffff;
                            SCROLLBAR-DARKSHADOW-COLOR: #ffffff
                        }
                        .simplemodal-container {
                            border: black 2px solid;
                        }
                        -->
                    </style>
                    <link href="../css/growmetry.css" rel="stylesheet" type="text/css" />
                    <link type='text/css' href='css/popup.css' rel='stylesheet' media='screen' />
                    <script type="text/javascript" src="js/jquery.js"></script>
                    <script type='text/javascript' src='js/jquery.simplemodal-1.4.4.js'></script>
                    <script language="JavaScript1.2" src="../main.js" type="text/javascript"></script>
                    <script type="text/javascript" src="js/lang.js"></script>
                    <script type='text/javascript' src='js/popup.js'></script>
                    <script src="includes/dhtmlxSuite/dhtmlxTree/codebase/dhtmlxcommon.js"></script>
                    <script>
                        popupOptions = {
                                <% If lng_id = 1 Then%>
                                // German
                                width: 640, 
                            height: 570
                                <% Else %>
                                // English
                            width: 640, 
                            height: 510
                                <% End If %>
				        
                            };
                        popupOptions2 = {
                            <% If lng_id = 1 Then%>
                                // German
                                width: 500, 
                                height: 350
                            <% Else %>
                                // English
                                width: 500, 
                                height: 350
                            <% End If %>
				        
                        };
                        String.prototype.trim = function(){
                            return this.replace(/^\s*(.+?)\s*$/, "$1");
                        };

                        function reloadCaptcha(){$("#imgCaptcha").attr('src', 'captcha_lost_pw.asp?' + new Date().getTime());}
                        function _focus(obj){
                            if (obj.value == "<%= fc_value_string(lng_id, "var_lost_pw_08") %>"){
                                obj.value = '';
                                obj.style.color = 'black';
                            }
                        }
                    function _blur(obj){
                        if (obj.value == ""){
                            obj.value = '<%= fc_value_string(lng_id, "var_lost_pw_08") %>';
                            obj.style.color = 'grey';
                        }
                    }
                    function _check_c(obj){
                        var a = /[0-9]{6}/
                        document.getElementById('btnSend').disabled = ! a.test(obj.value);
                    }
                    function _submit(){
                        if (! isEmailCorrect(document.getElementById('email'))) return;
                        var params = 'captcha='+document.getElementById('captcha').value+'&email='+document.getElementById('email').value+'&email2='+document.getElementById('email2').value+'&user_id='+document.getElementById('user_id').value+'&inquiry='+document.getElementById('inquiry').value;
                        dhtmlxAjax.post("lost_pw.asp", params, function(loader){
                            var resp = loader.xmlDoc.responseText;
                            if ( resp.substr(0, 1) == '{' ) {
                                var json = eval ("(" + resp + ")");
                                if ( json && typeof json === 'object' ) {
                                    if (json.status == 'error'){
                                        alert("Error: " + json.msg);
                                    } else {
                                        if (json.msg != '' && json.msg != undefined){
                                            lost_pw.close();
                                            document.getElementById('lost_pw_msg_text').innerHTML = json.msg;
                                            $('#lost_pw_msg_b').click();
                                        } else if (json.count && json.count > 1){
                                            lost_pw.close();
                                            var lost_pw_content_2 = document.getElementById('lost_pw_content_2').innerHTML;
                                            lost_pw_content_2 = lost_pw_content_2.replace(/\[number_email_found\]/, json.count);
                                            document.getElementById('lost_pw_content_2').innerHTML = lost_pw_content_2;
                                            $('.lost_pw_2').click();
                                            document.getElementById('email2').value = json.email;
                                            document.getElementById('inquiry').value = json.inquiry;
                                        }
                                    }
                                } else {
                                    alert('Unknown request error occured');
                                }
                            } else {
                                alert('Error requesting the data. Error: ' + loader.xmlDoc.responseText);
                            }
                        });
                    }
                    function isEmailCorrect(obj) { 
                        var re = /^\w+([\.-]?\w+)*@(((([a-z0-9]{2,})|([a-z0-9][-][a-z0-9]+))[\.][a-z0-9])|([a-z0-9]+[-]?))+[a-z0-9]+\.([a-z]{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/i;
                        if(re.test(obj.value)) return true;
                        else {
                            alert("<%= fc_value_string(lng_id, "var_lost_pw_20") %>");
                            obj.focus();
                            return false; 
                        } 
                    }
                    </script>
            </head>
            <body>
                <div id="TipLayer" style="visibility:hidden;position:absolute;z-index:1000;top:-100;"></div>
                <script language="JavaScript1.2" src="../style.js" type="text/javascript"></script>  
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td background="images/filler.jpg">&nbsp;</td>
                        <td width="950" height="550" background="<%= fc_value_link(lng_id, "var_index_admin_01") %>">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td width="43" height="550" rowspan="3">&nbsp;</td>
                                    <td height="200" align="left" valign="top"><img src="images/standard/logfiller.gif" width="330" height="170" border="0" usemap="#Map" />
                                        <%
                                        if lng_id = 2 then
                                        %>
                                        <a href="javascript: void(0);" onclick="<%= fc_value_link(2, "var_index_76") %>"><img src="../App/images/country/flag_germany.png" width="16" height="16" hspace="10" vspace="1" border="0" /></a>
                                        <% else %>
                                        <a href="javascript: void(0);" onclick="<%= fc_value_link(1, "var_index_76") %>"><img src="../App/images/country/flag_usa.png" alt="English version" width="16" height="16" hspace="10" vspace="1" border="0" /></a></td>
                                    <% end if %>
                                    <td height="550" rowspan="3">&nbsp;</td>
                                </tr>
                                <tr>
                                    <td height="150">
                                        <form name="login" method="Post" action="main_menu.asp?lng=1">
                                            <span class="txtsm"><%= fc_value_string(lng_id, "var_index_admin_02") %></span><br />
                                            <input name="T1" type="text" class="field" id="textfield" value="<%=a1%>" size="20" />
                                            <br />
                                            <span class="txtsm"><%= fc_value_string(lng_id, "var_index_admin_03") %></span><br />
                                            <input name="T2" type="password" class="field" id="textfield2" value="<%=a2%>" size="20" />
                                            <br />
                                            <br />
                                            <input name="button" type="submit" id="button" value="   <%= fc_value_string(lng_id, "var_index_admin_04") %>   " />&nbsp;&nbsp;
                                                   <input type="hidden" id="reg" name="reg" size="20" value="<%=str_emaillink%>" />
                                        </form>
                                        <div class="txtsm" style="font-size: 10px; font-weight: bold; padding-top: 12px;">
                                            <span class="lost_pw"><%= fc_value_string(lng_id, "var_index_admin_05") %></span>&nbsp;<span style="display: none;" class="lost_pw_2"></span>
                                        </div>
                                        <div id="lost_pw-modal-content">
                                            <div class="lost_pw_main">
                                                <div class="lost_pw_header"><%= fc_value_string(lng_id, "var_lost_pw_01") %></div>
                                                <div class="lost_pw_content" style="font-size: 13px;">
                                                    <%= fc_value_string(lng_id, "var_lost_pw_02") %>
                                                </div>
                                                <div class="lost_pw_email">
                                                    <div style="font-weight: bold; padding-bottom: 5px;"><%= fc_value_string(lng_id, "var_lost_pw_03") %></div>
                                                    <input type="text" id="email" name="email" style="width: 405px; color: grey;" value="<%= fc_value_string(lng_id, "var_lost_pw_08") %>" onfocus="_focus(this)" onblur="_blur(this)" />
                                                    <div style="font-size: 10px; text-align: right; padding-top: 5px;">
                                                       <a href="javascript: void(0);" onclick="
                                                           alert('<%= fc_value_string(lng_id, "var_lost_pw_10") %>')
                                                       "><%= fc_value_string(lng_id, "var_lost_pw_09") %></a>
                                                    </div>
                                                </div>
                                                <div class="lost_pw_content" style="padding-top: 30px; font-size: 13px;">
                                                    <%= fc_value_string(lng_id, "var_lost_pw_04") %>
                                                </div>
                                                <div class="lost_pw_captcha">
                                                    <img style=" float: left; border: 1px solid black;" id="imgCaptcha" src="captcha_lost_pw.asp" />
                                                    <div style="text-align: left; font-size: 10px; margin-left: 155px;">
                                                        <%= fc_value_string(lng_id, "var_lost_pw_05") %>
                                                    </div>
                                                </div>
                                                <div class="lost_pw_input">
                                                    <input id="captcha" name="captcha" style="width: 138px; margin-right: 5px; color: grey;" type="text" value="<%= fc_value_string(lng_id, "var_lost_pw_08") %>" onfocus="_focus(this)" onblur="_blur(this)" onkeyup="_check_c(this)" />
                                                           <a style="margin-right: 5px; position: relative; top: 6px;" href="javascript: void(0);" onclick="reloadCaptcha()">
                                                            <img src="images/reload.gif" border="0" /></a>
                                                </div>
                                                <div class="lost_pw_input" style="text-align: right;">
                                                    <input style="width: 70px;" id="btnSend" type="button" value="Send" onclick="_submit()" disabled />
                                                </div>
                                                <div style=" text-align: left; font-size: 10px; padding-top: 20px;">
                                                    <%= fc_value_string(lng_id, "var_lost_pw_06") %><br />
                                                    <%= fc_value_string(lng_id, "var_lost_pw_07") %>
                                                </div>
                                                <div style="margin-top: 30px;" class="txtlegal">
                                                    <a href="contact_us.asp"><%= fc_value_string(Session("ses_i_language"), "var_glob_txt_07") %></a> 
                                                    | <a href="about.asp"><%= fc_value_string(Session("ses_i_language"), "var_glob_txt_08") %></a> 
                                                    | <a href="terms.asp"><%= fc_value_string(Session("ses_i_language"), "var_glob_txt_09") %></a> 
                                                    | <a href="terms.asp#disclaimer"><%= fc_value_string(Session("ses_i_language"), "var_glob_txt_10") %></a> 
                                                    | <a href="terms.asp#privacy"><%= fc_value_string(Session("ses_i_language"), "var_glob_txt_11") %></a>
                                                </div>
                                            </div>
                                        </div>
                                        <div id="lost_pw-modal-content_2">
                                            <div class="lost_pw_main_2">
                                                <div class="lost_pw_header_2"><%= fc_value_string(lng_id, "var_lost_pw_01") %></div>
                                                <div id="lost_pw_content_2" class="lost_pw_content_2" style="font-size: 13px;">
                                                    <%= fc_value_string(lng_id, "var_lost_pw_14") %>
                                                </div>
                                                <div class="lost_pw_email_2">
                                                    <div style="font-weight: bold; padding-bottom: 5px;"><%= fc_value_string(lng_id, "var_lost_pw_15") %></div>
                                                    <input type="text" id="user_id" name="user_id" style="width: 305px;" value="<%= fc_value_string(lng_id, "var_lost_pw_08") %>" onfocus="_focus(this)" onblur="_blur(this)" />
                                                    <div style="font-size: 10px; text-align: right; padding-top: 5px;">
                                                       <a href="javascript: void(0);" onclick="
                                                           alert('<%= fc_value_string(lng_id, "var_lost_pw_12") %>')
                                                       "><%= fc_value_string(lng_id, "var_lost_pw_11") %></a>
                                                    </div>
                                                </div>
                                                <div class="lost_pw_email_2">
                                                    <div style="font-weight: bold; padding-bottom: 5px;"><%= fc_value_string(lng_id, "var_lost_pw_03") %></div>
                                                    <input type="text" id="email2" readonly name="email2" style="width: 305px; color: grey;" />
                                                    <input type="hidden" id="inquiry" name="inquiry" style="width: 305px;" />
                                                </div>
                                                <div class="lost_pw_email_2" style="text-align: right;">
                                                    <input style="width: 70px;" type="button" value="Send" onclick="_submit()" />
                                                </div>
                                            </div>
                                        </div>
                                        <span id="lost_pw_msg_b"></span>
                                        <div id="lost_pw_msg">
                                            <div id="lost_pw_msg_header"></div>
                                            <div id="lost_pw_msg_text"></div>
                                            <div id="lost_pw_msg_button">
                                                <input style="width: 100px;" type="button" value="OK" onclick="lost_pw_msg.close();" />
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td height="190">&nbsp;</td>
                                </tr>
                            </table>
                        </td>
                        <td background="images/filler.jpg">&nbsp;</td>
                    </tr>
                </table>

                <map name="Map" id="Map">
                    <area shape="rect" coords="-1,152,63,168" href="contact_us.asp" alt="Contact Us" />
                </map>
                <%
                If Err.Number Then
                Response.Write(Err.Description)
                Err.Clear
                End If
                %>
            </body>
        </html>
